﻿package II.controls {
	
	import flash.display.*;
	
	public class Util {

		public static function FindParentWithClass ( start:DisplayObject, c:Class ) : DisplayObject {
			
			if ( start == null || c == null || start.parent == null ) return null;
			
			var mvcCount:DisplayObjectContainer = start.parent; 
			
			while ( mvcCount != null && mvcCount.constructor != c ) {
				mvcCount = mvcCount.parent;
			}
			
			return mvcCount;
		}
		
	}
	
}
